npx expo run:android
,遇到應用程式的金鑰簽署錯誤。Error: adb: failed to install /Users/minjing/development/jim/NotificationProgress/android/app/build/outputs/apk/debug/app-debug.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.jim.notification signatures do not match newer version; ignoring!]
Error: /Users/minjing/Library/Android/sdk/platform-tools/adb -s 22161FDF6002B6 install -r -d --user 0 /Users/minjing/development/jim/NotificationProgress/android/app/build/outputs/apk/debug/app-debug.apk exited with non-zero code: 1
at ChildProcess.completionListener (/Users/minjing/development/jim/NotificationProgress/node_modules/@expo/spawn-async/src/spawnAsync.ts:67:13)
at Object.onceWrapper (node:events:634:26)
at ChildProcess.emit (node:events:519:28)
at maybeClose (node:internal/child_process:1105:16)
at Socket.<anonymous> (node:internal/child_process:457:11)
at Socket.emit (node:events:519:28)
at Pipe.<anonymous> (node:net:339:12)
...
at spawnAsync (/Users/minjing/development/jim/NotificationProgress/node_modules/@expo/spawn-async/src/spawnAsync.ts:28:21)
at ADBServer.runAsync (/Users/minjing/development/jim/NotificationProgress/node_modules/@expo/cli/src/start/platforms/android/ADBServer.ts:85:59)
at Object.installAsync (/Users/minjing/development/jim/NotificationProgress/node_modules/@expo/cli/src/start/platforms/android/adb.ts:217:10)
at AndroidDeviceManager.installAppAsync (/Users/minjing/development/jim/NotificationProgress/node_modules/@expo/cli/src/start/platforms/android/AndroidDeviceManager.ts:85:5)
at installAppAsync (/Users/minjing/development/jim/NotificationProgress/node_modules/@expo/cli/src/run/android/runAndroidAsync.ts:75:5)
at runAndroidAsync (/Users/minjing/development/jim/NotificationProgress/node_modules/@expo/cli/src/run/android/runAndroidAsync.ts:50:3)
先使用 adb uninstall (應用程式 package name,不需加括號)
來移除實體裝置中的應用程式。
再用 npx expo run:android
重新運行即可。
結果今天用 iTerm 開第一個 terminal 視窗,使用 npx expo start
先運行 Expo 服務。
再開第二個 terminal 視窗,
使用 adb logcat '*:S' ReactNative:D ReactNativeJS:D AndroidRuntime:E '*:E'
,
來過濾查看 React、JavaScript 相關的日誌。
再到第一個 terminal 視窗,執行 a
指令來開啟 Android 應用程式。
Press a │ open Android
應用程式就成功取得 ExponentPushToken 了。
在第一個 terminal 視窗可以看到 Log 顯示了該 Token。
LOG ExponentPushToken[值]